            <?php 
                require_once('header_sidebar.php');
                require_once('Class/evaluation.Class.php');
                require_once('Class/displayInHtml.Class.php');
            ?>
            <link rel="stylesheet" href="js/plugins/chosen/chosen.min.css">
            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                        <?php echo $translate->translate('HomePageRating'); ?>
                        <small><?php echo $translate->translate('NewRating'); ?></small>
                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i><?php echo $translate->translate('HomePageRating'); ?></a></li>
                        <li class="active"><?php echo $translate->translate('NewRating'); ?></li>
                    </ol>
                </section>
                <section class="content">
                    <div class="col-md-3">
                        <form action="new_rating.php" method="post">
                            <div class="form-group">
                                <?php 
                                        $eval = new evaluation();
                                        $result = $eval->listedEvalForm();
                                    ?>
                                <label><?php echo $translate->translate('TitleSelectEvaluation'); ?></label>
                                <div class="input-group input-group-sm">
                                    <select name="selectedEvaluation" class="form-control" placeholder='test'>
                                        <option disabled selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                        <?php 
                                            foreach ($result as $key => $value)
                                            {
                                                echo '<option value='.$value['id'].'>'. $value['name'] .'</option>';
                                            }
                                        ?>
                                    </select>
                                    <span class="input-group-btn">
                                        <button class="btn btn-info btn-flat" type="submit"><?php echo $translate->translate('TitleSelectEvaluationbtn'); ?></button>
                                    </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <?php if (isset($_GET['id'])) :?>
                        <div class="col-md-3 ">
                            <div class="alert alert-success alert-dismissable">
                                <i class="fa fa-check"></i>
                                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                                <b>Bravo !</b> Vous venez de terminer une évaluation elle porte le numéro : <b><?php echo $_GET['id']; ?></b>
                            </div>
                        </div>
                    <?php endif ?>
                    <?php if (isset($_POST['selectedEvaluation'])) :?>
                        <div id="toExport" class="col-md-12 box box-info">
                            <?php
                                $criteria       = array();
                                $levelMark      = array();
                                $headerTab      = array();
                                $unacceptable   = array();
                                $eval           = new evaluation();
                                $db             = new connexionDB();

                                $id_notApply    = $db->getIdCriteriaMark();
                                (isset($id_notApply[0]) ? $id_notApply=$id_notApply[0] : $id_notApply = array());
                                
                                $evaluationInfo = $eval->getEvaluationData($_POST['selectedEvaluation']);
                                if (isset($evaluationInfo['id']))
                                {
                                    $criteria = $eval->getCriteriaForEval($evaluationInfo['id']);
                                    $levelMark = $eval->getLevelMark($evaluationInfo['id']);
                                    $headerTab = evaluation::getHeader($levelMark);
                                }
                                $unacceptable = $db->getUnacceptable();
                            ?>
                            <h3 class="box-title">
                                <?php 
                                    echo $evaluationInfo['name'] . ' ';
                                 ?>
                                <i>
                                    <small>
                                        <?php 
                                            echo $evaluationInfo['date_created'];
                                            echo ' ('. strtoupper($evaluationInfo['author']) . ')';
                                        ?>
                                    </small>
                                </i>
                            </h3>
                            <form id="form_eval" action="submit_rating.php" method="post">
                                <div class="box-body">
                                    <div class="col-md-12">
                                        <h4 class="box-title">
                                            <?php echo $translate->translate('TitleReference'); ?>
                                        </h4>
                                    </div>
                                    <input hidden name="id_account"     type="text" value="<?php echo $session->id_account; ?>">
                                    <input hidden name="id_eval_form"   type="text" value="<?php echo $evaluationInfo['id']; ?>">
                                    <div class="row">
                                        <div class="col-md-2">
                                            <div id="date_call_div" class="form-group">
                                                <label><?php echo $translate->translate('DateCall'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-calendar"></i>
                                                    </div>
                                                    <input id="date_call" name="date_call" type="text" class="form-control" placeholder="JJ/MM/AAAA" maxlength="10">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="date_eval_div" class="form-group">
                                                <label><?php echo $translate->translate('DateEvaluation'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-calendar"></i>
                                                    </div>
                                                    <input id="date_eval" name="date_eval" type="text" class="form-control" maxlength="10" value="<?php echo date('d/m/Y');?>">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="n_akio_div" class="form-group">
                                                <label><?php echo $translate->translate('NAkio'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-laptop"></i>
                                                    </div>
                                                    <input id="n_akio" name="n_akio" type="text" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="n_order_div" class="form-group">
                                                <label><?php echo $translate->translate('NOrder'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-barcode"></i>
                                                    </div>
                                                    <input id="n_order" name="n_order" type="text" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-md-2">
                                            <div id="name_rater_div" class="form-group">
                                                <label><?php echo $translate->translate('NameRater'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa  fa-pencil-square-o"></i>
                                                    </div>
                                                    <input readonly id="name_rater" name="name_rater" type="text" class="form-control" value="<?php echo $session->firstname . ' ' . $session->lastname; ?>">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="team_div" class="form-group">
                                                <label><?php echo $translate->translate('team'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa  fa-pencil-square-o"></i>
                                                    </div>
                                                    <input readonly id="team" name="team" type="text" class="form-control" value="<?php echo $session->team; ?>">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="improvement" class="form-group">
                                                <label><?php echo $translate->translate('Improvement'); ?></label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-book"></i>
                                                    </div>
                                                    <input id="improvement" name="improvement" type="text" class="form-control">
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="account_type_div" class="form-group">
                                                <label><?php echo $translate->translate('EvaluationType'); ?> :</label><br>
                                                <input id="account_type" name="account_type" type="radio" class="form-control" value="junior"> Junior
                                                <input id="account_type" name="account_type" type="radio" class="form-control" value="senior"> Senior
                                            </div>
                                        </div>
                                    </div>
                                    <br>
                                    <div class='row'>
                                        <div class="col-md-2">
                                            <div id="name_consultant_div" class="form-group">
                                                <label><?php echo $translate->translate('Consultant'); ?> : </label>
                                                <div class="input-group">
                                                    <?php 
                                                        $consultant = $db->getAllConsultant();
                                                    ?>
                                                    <div id="name_consultant" class="box-content form-group">
                                                        <select id="name_consultant" name="name_consultant" class="form-control chosen-select">
                                                            <option value='' disabled selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                                            <?php 
                                                                foreach ($consultant as $key => $value)
                                                                {
                                                                    echo "<option value='".$value['name']."'>". $value['name'] ."</option>";
                                                                }
                                                            ?>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-3">
                                            <div id="topic" class="form-group">
                                                <div class="box-body">
                                                    <?php 
                                                        require_once("Class/evaluation.Class.php");

                                                        $eval = new evaluation();
                                                        $result = $eval->listedTopic();
                                                    ?>
                                                    <label for="list_topic"><?php echo $translate->translate('DescriptionListTopic'); ?></label>
                                                    <div id="list_topic" class="box-content form-group">
                                                        <select id="topic" name="topic" class="form-control chosen-select">
                                                            <option selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                                            <?php 
                                                                foreach ($result as $key => $value)
                                                                {
                                                                    echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
                                                                }
                                                            ?>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="country_div" class="form-group">
                                                <div class="box-body">
                                                    <?php 
                                                        $country = $db->getCountry();
                                                    ?>
                                                    <label for="list_topic"><?php echo $translate->translate('AdminNewAccountAccountCountry'); ?></label>
                                                    <div id="list_country" class="box-content form-group">
                                                        <select id="country" name="country" class="form-control chosen-select">
                                                            <option disabled selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                                            <?php 
                                                                foreach ($country as $key => $value)
                                                                {
                                                                    echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
                                                                }
                                                            ?>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="topic" class="form-group">
                                                <div class="box-body">
                                                    <?php 
                                                        $recipient = $db->getRecipient();
                                                    ?>
                                                    <label for="list_topic"><?php echo $translate->translate('Recipient'); ?></label>
                                                    <div id="list_country" class="box-content form-group">
                                                        <select id="recipient" name="recipient" class="form-control chosen-select">
                                                            <option value="" selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                                            <?php
                                                                foreach ($recipient as $key => $value)
                                                                {
                                                                    echo "<option value='".$value['id']."'>". $value['name'] ."</option>";
                                                                }
                                                            ?>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div>
                                        <div id="validation_div" class="form-group col-md-2">
                                            <label for="selectedValidation"><?php echo $translate->translate('Validation'); ?> :</label>
                                            <select id="selectedValidation" name="selectedValidation" class="form-control chosen-select">
                                                <option selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                                <option value="0">Oui</option>
                                                <option value="1">Non</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div id="groups_div" class="col-md-2">
                                            <label><?php echo $translate->translate('AdminNewAccountAccountGroup');?> :</label><br>
                                            <?php
                                                $groups = $db->getListedGroup();
                                            ?>
                                            <select id="group1" name="group1" class="form-control chosen-select" style="width:200px;" tabindex="2">
                                                <option value='' disabled selected><?php echo $translate->translate('TitleSelectEvaluationDefault'); ?></option>
                                                <?php foreach ($groups as $value) : ?>
                                                    <option value="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></option>
                                                <?php endforeach ?>
                                            </select>
                                    </div><br><br>
                                    <div class="col-md-12">
                                        <div class="box pull-right" id="final_mark_div">
                                            <div class="col-md-12 form-group">
                                                <label><?php echo $translate->translate('finalMark'); ?> :</label>
                                                <div class="col-md-12 input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa  fa-pencil-square-o"></i>
                                                    </div>
                                                    <input readonly id="final_mark" style="color:red;" name="final_mark" type="text" class=" col-md-12 form-control" value="0">
                                                </div><br><br>
                                                <div class=" col-md-12 input-group form-group">
                                                    <div id="submitBtn" type="submit" class="col-md-12 btn btn-primary"><?php echo $translate->translate('submitEval'); ?></div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-2">
                                            <div id="optional_mark_div" class="form-group">
                                                <label><?php echo $translate->translate('optionalMark'); ?> :</label>
                                                <div class="input-group">
                                                    <div class="input-group-addon">
                                                        <i class="fa  fa-pencil-square-o"></i>
                                                    </div>
                                                    <input readonly id="optional_mark" name="optional_mark" type="text" class="form-control" value="0">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <br><br>
                                    <br><br>
                                    <table class="table table-bordered">
                                        <tbody>
                                            <tr class='bg-aqua'>
                                                <th><?php echo $translate->translate('NameCriteria'); ?></th>
                                                <th width='30%'><?php echo $translate->translate('DescriptionCriteria'); ?></th>
                                                <?php 
                                                    foreach ($levelMark as $key => $value)
                                                    {
                                                        echo '<th>'. $value['name'] . '(' . $value['mark'] .'/20) </th>';
                                                    }
                                                ?>
                                                <th> N/A </th>
                                                <th width='30%'><?php echo $translate->translate('Commentary'); ?></th>
                                            </tr>
                                            <?php foreach ($criteria as $key => $value) { ?>
                                                <?php 
                                                    if ($value['set_to_zero'] == 1)
                                                    {
                                                        $classSetToZero = 'setToZero';
                                                    }
                                                    else
                                                    {
                                                        $classSetToZero = '';   
                                                    }
                                                ?>
                                                <tr id="<?php echo 'criteria_' . $value['id'];?>" class="<?php echo $classSetToZero;?>">
                                                    <td class='bg-aqua'>
                                                        <?php echo $value['name']; ?>
                                                        <?php if ($classSetToZero != '') : ?>
                                                            <br><br><i class="fa fa-fw fa-exclamation"></i><?php echo $translate->translate('setToZero'); ?>
                                                        <?php endif?>
                                                    </td>
                                                    <td><?php echo $value['description']; ?></td>
                                                    <?php
                                                        $criteria_name_h = $value['name'];
                                                        $id_criteria    = $value['id']; 
                                                        $coefficient    = $value['coefficient'];
                                                        foreach ($headerTab as $keyb => $valueb) 
                                                        {
                                                            $displayCheckBox = evaluation::isAMark($criteria_name_h, $valueb, $id_criteria);
                                                            if ($displayCheckBox != NULL)
                                                            {
                                                                if ($valueb != "Situation inacceptable")
                                                                {
                                                                    if ($displayCheckBox['activate'] == 1)
                                                                    {
                                                                        echo    "<td>
                                                                                <div align='center'>
                                                                                    <input 
                                                                                    id='"   . $displayCheckBox['id']  
                                                                                            . '_' 
                                                                                            . $valueb 
                                                                                            . '_'
                                                                                            . $displayCheckBox['mark'] 
                                                                                            . '_' 
                                                                                            . $coefficient 
                                                                                            ."' name='criteria_"
                                                                                            . $id_criteria
                                                                                            ."' type='radio' value='". $displayCheckBox['id'] ."'>
                                                                                    <span onclick='showDiv();' id='exclamation_mark' class='glyphicon glyphicon-exclamation-sign'></span>
                                                                                    <div class='test box-body' style='visibility:hidden'>
                                                                                        ". $displayCheckBox['description']."
                                                                                    </div>
                                                                                </div>
                                                                            </td>";
                                                                    }
                                                                    else
                                                                    {
                                                                        echo "<td class='bg-gray'></td>";
                                                                    }
                                                                    
                                                                }
                                                                else 
                                                                {
                                                                    echo    "<td>
                                                                                <div align='center'>
                                                                                    <input 
                                                                                    id='"   . $displayCheckBox['id']
                                                                                            . '_' 
                                                                                            . $valueb 
                                                                                            . '_'
                                                                                            . $displayCheckBox['mark'] 
                                                                                            . '_' 
                                                                                            . $value['coefficient'] 
                                                                                            ."' name='criteria_"
                                                                                            . $value['id']
                                                                                            ."' type='radio' value='". $displayCheckBox['id'] ."'>
                                                                                </div><br>
                                                                            ";
                                                                    echo "<select id='selectUnacceptable' name='criteria_". $value['id'] ."_unacceptable' class='form-control '>
                                                                            <option value='null'>...</option>";

                                                                    foreach ($unacceptable as $value)
                                                                    {
                                                                        echo "<option value='".$value['id']."'>". $value['description'] ."</option>";
                                                                    }
                                                                    echo "</td>";
                                                                }
                                                            }
                                                            else
                                                            {
                                                                echo "<td class='bg-gray'></td>";
                                                            }
                                                        }
                                                    ?>
                                                    <td>
                                                        <input id="<?php echo $id_notApply['id']. '_notApply_'. $id_notApply['mark'] .'_' . $coefficient; ?>" name="<?php echo 'criteria_'. $id_criteria;?>" type="radio" value="<?php echo $id_notApply['id']; ?>">
                                                    </td>
                                                    <td>
                                                        <textarea class='form-control' rows='3' name="<?php echo 'commentary_' . $key;?>"></textarea>
                                                    </td>
                                                </tr>
                                            <?php } ?>
                                        </tbody>
                                    </table>
                                    <?php //Code to transfer a php array into a js array
                                        echo "<script>
                                        var criteriaJs = new Array();
                                        var i = 0;";

                                        foreach ($criteria as $key => $value)
                                        {
                                            echo "criteriaJs[i] ='criteria_" . $value['id'] . "';";
                                            echo "i++;";
                                        }
                                        echo "</script>";
                                    ?>
                                </div>
                            </form>
                        </div>
                    <?php endif ?>
                </section>
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper don't delete it -->
        <?php require_once('footer.php');?>
        <script src="js/plugins/chosen/chosen.jquery.min.js" type="text/javascript"></script>
        <!-- Export Excel -->
        <script type="text/javascript" src="js/plugins/excellentexport/excellentexport.min.js"></script>
        <script>
            $('#date_call').datepicker({
                format : 'dd/mm/yyyy',
            });
            $('#date_eval').datepicker({
                format : 'dd/mm/yyyy',
            });
            function showDiv()
            {
                if ($('.test').css('visibility') == 'visible')
                    $('.test').css('visibility', 'hidden');
                else
                    $('.test').css('visibility', 'visible');
            }

            $('#submitBtn').click(function(){
                validateForm();   
            });
            finalMarkStatic = {};

            function calculateMark()
            {
               mark = 0

                $.each(finalMarkStatic, function(key, value) {
                    //console.log(value, '|');
                    //console.log(key);
                    mark += parseFloat(value);
                })
                if ($( "input[id*='Situation inacceptable']" ).is(':checked'))
                {
                    $('#final_mark').val(0);
                    $('#optional_mark').val(mark);
                }
                else
                {
                    $('#final_mark').val(mark);
                    $('#optional_mark').val(mark);
                }

                mark = $('.setToZero').find('input:checked').each(function(){
                    mark = $(this).attr('id');

                    mark = mark.split('_');
                    mark = mark[2];

                    if (mark == 0)
                    {
                        $('#final_mark').val(0);
                    }
                });

                changeColor();
            }
            function changeColor()
            {
                var mark_final = $('#final_mark').val();
                if ( mark_final <= 75)
                {
                    $('#final_mark').attr('style','color:red');
                }
                else if (mark_final > 75 && mark_final <= 84)
                {
                    $('#final_mark').attr('style','color:orange');
                }
                else if (mark_final >= 85)
                {
                    $('#final_mark').attr('style','color:green');   
                }
            }

            $('input:radio').on('ifChecked', function(event){
              if ($(this).attr('name') != 'account_type')
              {
                val = $(this).attr('id').split('_');
                value = val[2];
                coeff = val[3];

                console.log(val, value, coeff);

                result = parseFloat(value) * parseFloat(coeff) * 5;
                finalMarkStatic[$(this).attr('name')] = result;
                calculateMark();
              };
            });
            

            function cleanError()
            {
                $('.error').hide();
                $('#date_call_div').removeClass('has-error');
                $('#date_eval_div').removeClass('has-error');
                $('#n_akio_div').removeClass('has-error');
                $('#n_order_div').removeClass('has-error');
                $('#name_rater_div').removeClass('has-error');
                $('#name_consultant_div').removeClass('has-error');
                $('#account_type_div').removeClass('has-error');
                $('#country_div').removeClass('has-error');
                $('#groups_div').removeAttr('style');
                $('#groups_div').removeClass('has-error');
            }

            function isGroupSelected()
            {
                var maxGroup = "<?php if (isset($groups)) { echo count($groups); } ?>";
                var selectedGroup = 0;
                    
                for (var i = maxGroup - 1; i >= 0; i--)
                {
                    if ($('input:checkbox[name=group'+ i +']').is(':checked') == true)
                    {
                        ++selectedGroup;
                    }
                };
                if (selectedGroup > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }

            function isCriteriaChecked()
            {
                error = false;
                for (var i = criteriaJs.length - 1; i >= 0; i--) {
                    if ($('input:radio[name='+ criteriaJs[i] +']').is(':checked') == false)
                    {
                        $('#'+ criteriaJs[i]).css('color', 'red');
                        error = true;
                    }
                    else
                    {
                        $('#' + criteriaJs[i]).css('color', 'black');
                    }
                };
                return error;
            }

            function validateForm()
            {
                var nameReg =  /^[a-zA-Z\s]*$/;
                var numberReg =  /^[0-9]+$/;
                var dateReg = new RegExp(/\b\d{1,2}[\/-]\d{1,2}[\/-]\d{4}\b/);

                var dateCall = $('#date_call').val();
                var dateEval = $('#date_eval').val();
                var nAkio = $('#n_akio').val().trim();
                var nCommmande = $('#n_order').val().trim();
                var nameRater = $('#name_rater').val();
                var nameConsultant = $('#name_consultant option:selected').val();
                var accountType = $('input:radio[name=account_type]');

                var errors = false;

                var grp = $('#group1 option:selected').val();
                var grpName = $('#name_consultant option:selected').val();

                grpName = grpName.split('_');
                grpName = grpName[0];
                console.log(grpName, grp);
                
                cleanError();
                errors = isCriteriaChecked();

                if (accountType.is(':checked') == false) {
                    $('#account_type_div').addClass('has-error');
                    errors = true;
                }

                if ($('#group1 option:selected').val() == '')
                {
                    $('#groups_div').css({ "color": 'red'});
                    errors = true;
                }

                if (!dateReg.test(dateCall)) {
                    errorPhp = "<?php echo $translate->translate('errorDate'); ?>";
                    $('#date_call_div').after('<span class="error" style="color:red;">'+ errorPhp +'</span>');
                    $('#date_call_div').addClass('has-error');
                    errors = true;
                }

                if (!dateReg.test(dateEval)) {
                    errorPhp = "<?php echo $translate->translate('errorDate'); ?>";
                    $('#date_eval_div').after('<span class="error" style="color:red;">'+ errorPhp +'</span>');
                    $('#date_eval_div').addClass('has-error');
                    errors = true;
                }

                if (!numberReg.test(nAkio)) {
                    errorPhp = "<?php echo $translate->translate('errorNumber'); ?>";
                    $('#n_akio_div').after('<span class="error" style="color:red;">'+ errorPhp +'</span>');
                    $('#n_akio_div').addClass('has-error');
                    errors = true;
                }

                if (!numberReg.test(nCommmande)) {
                    errorPhp = "<?php echo $translate->translate('errorNumber'); ?>";
                    $('#n_order_div').after('<span class="error" style="color:red;">'+ errorPhp +'</span>');
                    $('#n_order_div').addClass('has-error');
                    errors = true;
                }

                if (nameRater == '') {
                    errorPhp = "<?php echo $translate->translate('errorName'); ?>";
                    $('#name_rater_div').after('<span class="error" style="color:red;">'+ errorPhp +'</span>');
                    $('#name_rater_div').addClass('has-error');
                    errors = true;
                }

                if (nameConsultant == '') {
                    $('#name_consultant_div').addClass('has-error');
                    errors = true;
                }

                if (typeof($('#country option:selected').attr('value')) == 'undefined')
                {
                    $('#country_div').addClass('has-error');
                    errors = true;
                }

                if (errors == true)
                {
                    $('html, body').animate({ scrollTop: 0 }, 'slow');
                }
                else
                {
                    $('#form_eval').submit();
                }
            }

            var config = {
              '.chosen-select'           : {}
            }
            for (var selector in config) {
              $(selector).chosen(config[selector]);
            }
        </script>